

const TokenKey = 'leju-token'
const userinfo = 'leju-userinfo'
export function getToken() {
  return JSON.parse(localStorage.getItem(TokenKey))
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, JSON.stringify(token))
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function getUserInfo() {
  return JSON.parse(localStorage.getItem(userinfo))
}

export function setUserInfo(val) {
  return localStorage.setItem(userinfo, JSON.stringify(val))
}

export function removeUserInfo() {
  return localStorage.removeItem(userinfo)
}

export function removeAll(){
  removeToken();
  removeUserInfo()
}
